$(function () {
    var validate = $("#loginForm").validate({
        errorElement: 'span',
        rules: {
            userName: {
                required: true,
            },
            userPassword: {
                required: true,
            }
        },
        messages: {
            userName: {
                required: "请输入用户名",
            },
            userPassword: {
                required: "密码不能为空",
            }
        }
    })

    $("#login").click(function () {
        if (validate.form()) {
            $("#loginForm").submit();
        }
    })
})